<!-- 将table表格导出excel格式 -->
<template>
    <div></div>
</template>

<script setup lang='ts'>
import { exportExcel } from '@/hooks/exportExcel/index';
import { ref } from 'vue';

const TableList = ref([])

// 表格标题重置
const TableTitleReset = () => {
    return [
        { key: 'index', title: '序号' },
        { key: 'username', title: '工号' },
        { key: 'realName', title: '姓名' },
        { key: 'score', title: '工作量' },
        { key: 'projectCnt', title: '教改立项' },
        { key: 'thesisCnt', title: '教改论文' },
        { key: 'matchCnt', title: '教学比赛' },
        { key: 'achievementCnt', title: '教学成果奖' },
        { key: 'caseCnt', title: '教学案例' },
        { key: 'intershipCnt', title: '实习成果' },
        { key: 'courseCnt', title: '精品课程' },
        { key: 'innovationCnt', title: '大创立项' },
        { key: 'publishCnt', title: '教材出版' },
        { key: 'otherCnt', title: '其它' },
    ]
}

// 导出
const changeExport = async () => {
    const params = {
        headers: TableTitleReset(),
        excelData: TableList.value.map((item: any, index: number) => {
            return {
                index: index + 1,
                ...item
            }
        }),
    }
    exportExcel(params)
}
</script>
<style lang="scss" scoped></style>